﻿package com.rragona.utils.localTracer
{
    import flash.display.Sprite;
    import flash.net.LocalConnection;
    import flash.events.StatusEvent;

    public class Sender 
	{
        private static var _conn:LocalConnection;
        
        public function Sender() 
		{
            trace("Sender is a static class and should not be instantiated.");
        }
        
        public static function sendMessage(toSend:*):void 
		{
			_conn = new LocalConnection();
            _conn.addEventListener(StatusEvent.STATUS, onStatus);
			
            _conn.send("myConnection", "lcHandler", toSend);
			trace(toSend);
        }
        
        private static function onStatus(event:StatusEvent):void 
		{
            switch (event.level) 
			{
                case "status":
                    //trace("LocalConnection.send() succeeded");
                    break;
                case "error":
                    //trace("LocalConnection.send() failed");
                    break;
            }
        }
    }
}
